﻿Imports Aricie.DNN.Modules.LuceneSearch.Business
Imports DotNetNuke.Services.Sitemap

Namespace Aricie.DNN.Modules.LuceneSearch.SiteMap

    Public Class LuceneSearchSitemapProvider
        Inherits DotNetNuke.Services.Sitemap.SitemapProvider


        Public Overrides Function GetUrls(ByVal portalId As Integer, ByVal ps As DotNetNuke.Entities.Portals.PortalSettings, ByVal version As String) As System.Collections.Generic.List(Of DotNetNuke.Services.Sitemap.SitemapUrl)


            Dim luceneSiteMap As UrlCollection = BusinessController.GetSitemap(portalId)
            Dim toReturn As New List(Of DotNetNuke.Services.Sitemap.SitemapUrl)(luceneSiteMap.Count)
            For Each luceneUrl As Url In luceneSiteMap
                Dim toAdd As New SitemapUrl()
                toAdd.Url = luceneUrl.Location
                toAdd.Priority = luceneUrl.Priority
                toAdd.LastModified = luceneUrl.LastModified

                toAdd.ChangeFrequency = CType(System.Enum.Parse(GetType(SitemapChangeFrequency), luceneUrl.ChangeFrequency.ToString), SitemapChangeFrequency)
                toReturn.Add(toAdd)
            Next

            Return toReturn

        End Function
    End Class

End Namespace


